<template>
	<view>
		<view class="shixungjia">
			<view class="maozi">
				<view class="tubiao iconfont icon-shixi"></view>
			</view>
			<view class="ziti">实训管家</view>
		</view>
		<button class="cu-btn round" style="background-color: rgb(58,115,244);" @tap="login()">点击开启</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad() {
			this.getCode()
		},
		methods: {
			getCode(){
				uni.login({
					provider:'weixin',
					success: (loginRes)=> {
						this.code = loginRes.code
					}
				});
			},
			login(){
				var postData = {};
				uni.getUserProfile({
					desc: '用于完善会员资料',
					success: (res) => {
						postData.encryptedData = res.encryptedData
						postData.iv = res.iv
						postData.code = this.code
						 
						
						uni.request({
							url:'https://wxzx.gzzww.cn/api/wx_app_login',
							data:postData,
							method:"POST",
							success: (res)=>{
								uni.reLaunch({
								    url: '../index/index'
								});
							}
						})
					}
				})
			}
		}
	}
</script>

<style>
	page{
		background-color: rgb(58,115,244);
	}
	.shixungjia{
		position: fixed;
		margin-top: 330rpx;
		margin-left: 262rpx;
		text-align: center;
		
	}
	.maozi{
		width: 240rpx;
		height: 240rpx;
		background-color: rgb(254,254,254);
		border-radius: 55rpx;
		text-align: center;
		margin-left: 16rpx;
	}
	.tubiao{
		font-size: 208rpx;
		padding-top: 15rpx;
		color: rgb(74,86,224);
	}
	.ziti{
		font-size: 72rpx;
		margin-top: 50rpx;
		color: rgb(224,243,255);
	}
	.cu-btn{
		position: fixed;
		margin-top: 1200rpx;
		margin-left: 160rpx;
		text-align: center;
		border: solid 1rpx rgb(121,178,255);
		color: rgb(239,243,254);
		height: 112rpx;
		width: 482rpx;
		font-size: 42rpx;
	}
</style>
